package com.ia.pandora;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.TextView;

public class MainActivity extends Activity {
	
	private TextView txtvMessage;
	
	/**
	 * Loads the native library
	 */
	static {
		System.loadLibrary("iaDemo");
	}

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        initViews();
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }
    
    /**
     * Initializes the whole view hierarchy
     */
    private void initViews() {
    	txtvMessage = (TextView) findViewById(R.id.txtvMessage);
    	// sets the message from native code, to the java ui component
    	txtvMessage.setText(getMessage());
    }
    
    /**
     * Native method implemented in native side of application.
     * Demo for testing JNI connection
     * @return
     */
    public native String getMessage();
}
